import { useEffect, useState } from 'react'
import axios from 'axios'

const Demo4 = () => {
  const [lunbo, setLunbo] = useState([])
  // 获取轮播图
  const getLunbo = async () => {
    let {
      data: { message },
    } = await axios.get('https://dog.ceo/api/breeds/image/random/12')
    setLunbo(message)
  }

  // mounted
  useEffect(() => {
    getLunbo()
  }, [])

  return (
    <>
      <h3>Demo4</h3>
      <ul>
        {lunbo.map((item) => {
          return (
            <li key={item}>
              <img src={item} />
            </li>
          )
        })}
      </ul>
    </>
  )
}

export default Demo4
